package close.util;

public class BitMask {
	private BitMask(){}
	
	//Returns value of the bit in position given by nBit
	public static int getBit(byte mask, int nBit){
		if(nBit >= 0 && nBit < 8){
			return (mask & (1<<(nBit)));
		} else {
			return 0;
		}
	}
	
	//Returns 1 or 0 depending on the specified bits state
	public static int getBitStatus(byte mask, int nBit){
		int n = getBit(mask, nBit);
		if(n == 0){
			return 0;
		} else {
			return 1;
		}
	}
		
}
